function t(t, a) {
    if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
    return !a || "object" != typeof a && "function" != typeof a ? t : a;
}

function a(t, a) {
    if ("function" != typeof a && null !== a) throw new TypeError("Super expression must either be null or a function, not " + typeof a);
    t.prototype = Object.create(a && a.prototype, {
        constructor: {
            value: t,
            enumerable: !1,
            writable: !0,
            configurable: !0
        }
    }), a && (Object.setPrototypeOf ? Object.setPrototypeOf(t, a) : t.__proto__ = a);
}

function e(t, a) {
    if (!(t instanceof a)) throw new TypeError("Cannot call a class as a function");
}

Object.defineProperty(exports, "__esModule", {
    value: !0
});

var i = function() {
    function t(t, a) {
        for (var e = 0; e < a.length; e++) {
            var i = a[e];
            i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), 
            Object.defineProperty(t, i.key, i);
        }
    }
    return function(a, e, i) {
        return e && t(a.prototype, e), i && t(a, i), a;
    };
}(), n = exports.dateData = function() {
    function t(a) {
        e(this, t), this.all_day_num = 0, this.get_value = [], this.date_data1 = [], this.date_data2 = [], 
        this.data_list = a.data, this.pop_switch = !0;
        var i = this.dateChange(a.init_data.last_btn_num);
        this.last_btn_num = i.num, this.last_btn_date = i.day_num, this.last_data = a.init_data.last_data, 
        this.btn_bool = a.btn_bool, this.initData();
    }
    return i(t, [ {
        key: "dateChange",
        value: function(t) {
            var a = new Date(t), e = a.getDate();
            return {
                day_num: e,
                num: e + new Date(a.getFullYear(), a.getMonth(), 1).getDay() - 1
            };
        }
    }, {
        key: "dealDate",
        value: function(t, a) {
            var e = t.getTime(), i = t.getDay(), n = parseInt(new Date().getDate());
            t.setMonth(t.getMonth() + 1), t.setDate(0);
            for (var s = t.getDate() + i, l = [], u = 0; u < s; u++) switch (!0) {
              case u < i:
                l.push({
                    value: "",
                    type: "before",
                    num: u
                });
                break;

              case u > n + i && a:
                l.push({
                    value: u - i + 1,
                    day_num: u - i + 1,
                    type: "next",
                    date_times: e + 864e5 * (u - i),
                    num: u
                }), this.all_day_num++;
                break;

              case u == n + i - 1 && a:
                l.push({
                    value: "今天",
                    day_num: u - i + 1,
                    type: "now",
                    date_times: e + 864e5 * (u - i),
                    num: u
                }), this.all_day_num++;
                break;

              case u == n + i && a:
                l.push({
                    value: "明天",
                    day_num: u - i + 1,
                    type: "now",
                    date_times: e + 864e5 * (u - i),
                    num: u
                }), this.all_day_num++;
                break;

              case u < 30 - this.all_day_num + i && !a:
                l.push({
                    value: u - i + 1,
                    day_num: u - i + 1,
                    type: "next",
                    date_times: e + 864e5 * (u - i),
                    num: u
                });
                break;

              default:
                l.push({
                    value: u - i + 1,
                    day_num: u - i + 1,
                    type: "before",
                    date_times: e + 864e5 * (u - i),
                    num: u
                });
            }
            return l;
        }
    }, {
        key: "dateBtn",
        value: function(t, a) {
            if (t.target.dataset.alldata && (t.target.dataset.alldata.type.indexOf("next") > -1 || t.target.dataset.alldata.type.indexOf("now") > -1)) {
                var e = this[t.target.dataset.data];
                this.pop_switch = !0, !this[this.last_data] && this.btn_bool && (this[this.last_data][this.last_btn_num].type = this[this.last_data][this.last_btn_num].type.replace("active ", ""));
                var i = e[parseInt(t.target.dataset.alldata.num)].type;
                if (!(i.indexOf("active") > -1) || this.btn_bool) return e[parseInt(t.target.dataset.alldata.num)].type = "active " + i, 
                this.last_btn_num = t.target.dataset.alldata.num, this.last_data = t.target.dataset.data, 
                this.btn_bool ? this.get_value = [ t.target.dataset ] : this.get_value.push(t.target.dataset), 
                t.target;
                e[parseInt(t.target.dataset.alldata.num)].type = i.replace("active ", "");
                for (var n = 0; n < this.get_value.length; n++) t.target.dataset.alldata.num == this.get_value[n].alldata.num && this.get_value.splice(n, 1);
            } else this.pop_switch = !1;
        }
    }, {
        key: "initData",
        value: function() {
            var t = new Date(), a = new Date(t.getFullYear(), t.getMonth(), 1), e = new Date(t.getFullYear(), t.getMonth() + 1, 1);
            this.date_data1 = this.dealDate(a, !0), this.date_data2 = this.dealDate(e, !1), 
            this.btn_bool && (this.checkDate(this.date_data1), this.checkDate(this.date_data2)), 
            this[this.last_data][this.last_btn_num].type = "active " + this[this.last_data][this.last_btn_num].type, 
            this.get_value = [ {
                alldata: this[this.last_data][this.last_btn_num],
                data: this.last_data
            } ];
        }
    }, {
        key: "checkDate",
        value: function(t) {
            var a = [];
            a = this.data_list.map(function(t) {
                return t.date;
            });
            var e = this;
            t.map(function(t) {
                if (t.date_times) {
                    var i = e.formatTime(t.date_times);
                    -1 == a.indexOf(i) && (t.type = "before");
                }
            });
        }
    }, {
        key: "formatTime",
        value: function(t) {
            var a = new Date(t), e = a.getFullYear(), i = a.getMonth() + 1, n = a.getDate();
            return i = i > 9 ? i : "0" + i, n = n > 9 ? n : "0" + n, e + "-" + i + "-" + n;
        }
    }, {
        key: "getValue",
        value: function() {
            return this.get_value;
        }
    }, {
        key: "getSwitch",
        value: function() {
            return this.pop_switch;
        }
    }, {
        key: "setValue",
        value: function(t) {
            this.get_value = t;
        }
    } ]), t;
}();

exports.dateDataPrice = function(s) {
    function l(a) {
        e(this, l);
        var i = t(this, (l.__proto__ || Object.getPrototypeOf(l)).call(this, a));
        return i.max_num = 1, i.final_num = 1, i.init_bool = [ !1, !1 ], i.init_bool_num = 0, 
        i.curMonth = a.data.curMonth || [], i.nextMonth = a.data.nextMonth || [], i.dealDataPrice(i.curMonth, i.date_data1), 
        i.dealDataPrice(i.nextMonth, i.date_data2), i;
    }
    return a(l, n), i(l, [ {
        key: "dealDataPrice",
        value: function(t, a) {
            for (var e = 0, i = 0; i < a.length; i++) if (t && t.length > 0 && t[e]) {
                var n = new Date(t[e].useTime).getDate();
                if (a[i].day_num == n) {
                    if (this.last_btn_date == n && (this.init_bool[this.init_bool_num] = !0), a[i].type && "before" != a[i].type) {
                        a[i].seat = t[e];
                        var s = t[e].remainQuantity;
                        s < 1 ? (this.last_btn_date == n && (this.init_bool[this.init_bool_num] = !1), a[i].type = "before", 
                        a[i].price_vlue = "已售罄") : a[i].price_vlue = t[e].promotionCost, this.max_num < s && (this.max_num = s);
                    }
                    e++;
                } else a[i].type = "before";
            } else a[i].type = "before";
            this.init_bool_num++, this.init_bool[0] || this.init_bool[1] || 2 !== this.init_bool_num || (this.setValue([]), 
            this.init_bool_num = 0);
        }
    }, {
        key: "addNum",
        value: function() {
            if (this.final_num < this.max_num) {
                this.final_num++;
                for (var t = 0; t < this.date_data1.length; t++) "before" != this.date_data1[t].type && this.date_data1[t].seat && this.date_data1[t].seat.remainQuantity < this.final_num && (this.date_data1[t].type = "before", 
                this.date_data1[t].price_vlue = "数量不足");
                for (var a = 0; a < this.date_data2.length; a++) "before" != this.date_data2[a].type && this.date_data2[a].seat && this.date_data2[a].seat.remainQuantity < this.final_num && (this.date_data2[a].type = "before", 
                this.date_data2[a].price_vlue = "数量不足");
                for (var e = 0; e < this.get_value.length; e++) {
                    var i = this.get_value[e].alldata.num;
                    this[this.get_value[e].data][i].type.indexOf("before") > -1 && (this.get_value.splice(e, 1), 
                    e--);
                }
            }
            return this.final_num >= this.max_num ? {
                final_num: this.final_num,
                final_bool: !1,
                final_r_bool: !0
            } : this.final_num <= 1 ? {
                final_num: this.final_num,
                final_bool: !0,
                final_r_bool: !1
            } : {
                final_num: this.final_num,
                final_bool: !0,
                final_r_bool: !0
            };
        }
    }, {
        key: "reduceNum",
        value: function() {
            if (this.final_num > 1) {
                this.final_num--;
                for (var t = 0; t < this.date_data1.length; t++) "" != this.date_data1[t].value && this.date_data1[t].seat && this.date_data1[t].seat.remainQuantity >= this.final_num && "数量不足" == this.date_data1[t].price_vlue && (this.date_data1[t].type = "今天" == this.date_data1[t].value || "明天" == this.date_data1[t].value ? "now" : "next", 
                this.date_data1[t].price_vlue = this.date_data1[t].seat.promotionCost);
                for (var a = 0; a < this.date_data2.length; a++) "" != this.date_data2[a].value && this.date_data2[a].seat && this.date_data2[a].seat.remainQuantity >= this.final_num && "数量不足" == this.date_data2[a].price_vlue && (this.date_data2[a].type = "今天" == this.date_data2[a].value || "明天" == this.date_data2[a].value ? "now" : "next", 
                this.date_data2[a].price_vlue = this.date_data2[a].seat.promotionCost);
            }
            return this.final_num >= this.max_num ? {
                final_num: this.final_num,
                final_bool: !1,
                final_r_bool: !0
            } : this.final_num <= 1 ? {
                final_num: this.final_num,
                final_bool: !0,
                final_r_bool: !1
            } : {
                final_num: this.final_num,
                final_bool: !0,
                final_r_bool: !0
            };
        }
    }, {
        key: "getFinalNum",
        value: function() {
            return this.final_num;
        }
    } ]), l;
}();